Skip to content

Conversation

@AlexJones0
Copy link
Contributor

@AlexJones0 AlexJones0 commented Nov 18, 2025

To enable use of provisioning flows in QEMU, we need the ability to use the SPI console with the TX-ready indicator GPIO pin, as this console is widely used during the provisioning flows. The current implementation relies on synchronization logic with tight timing & ordering assumptions made for speed, which do not necessarily hold up in the emulated QEMU execution environment (see the commit messages & comments for more details).

This PR introduces an additional piece of synchronization to the TX ready pin which is only implemented for QEMU interfaces, and updates tests that use the SPI console to provide the correct interface (aside: maybe there is a nicer way to do this globally, rather than pass it in everywhere?) The QEMU version is then bumped to pull in some fixes to the SPI device that will allow this feature to work, and a relevant test //sw/device/tests:ottf_console_with_gpio_tx_indicator_test_sim_qemu_rom_with_fake_keys is supported for testing this behaviour.

This is only enabled if the QEMU interface is configured for the SPI
console - any other interface will retain the existing behaviour and
avoid the additional poling from the host side.

For QEMU specifically, we introduce a host-side poll to see the TX ready
pin go low after reading out the header (but before reading out the
payload). This ensures we don't run into synchronization issues due to
emulation for very small SPI transfers in which the entirity of the
header & payload are read out by the host before the device has a chance
to run enough guest SW to signal that the GPIO ready pin should go low.

In such a scenario, the device would look to host SW as if it is ready
to send more data, even though in reality the guest SW has barely
progressed enough to register that the host has started reading, causing
the two devices to get out of sync.

Signed-off-by: Alex Jones <[email protected]>
Includes fixes to the SPI device necessary to get the SPI console
working when using the TX indicator GPIO, in addition to other new
features and fixes (flash reads on unint flash, TPM hw registers, USB
fixes and bus handling, etc.)

Signed-off-by: Alex Jones <[email protected]>
Enables the `ottf_console_with_gpio_tx_indicator` test target for the
QEMU execution environment, as this test exercises functionality that is
required to be supported for provisioning flows.

As QEMU does not currently implement the relevant Pinmux connections
between OpenTitan and GPIO, a minor extension is made to the test to
allow users to optionally specify which GPIO pin should be used as the
ready-indicator, rather than hardcoding to IOA5. This is then overriden
for the QEMU execution environment only.

Signed-off-by: Alex Jones <[email protected]>
@AlexJones0 AlexJones0 force-pushed the qemu_spi_console_wait_tx branch from 333a622 to a5651b6 Compare November 19, 2025 13:11
@AlexJones0 AlexJones0 marked this pull request as ready for review November 19, 2025 13:12
@AlexJones0 AlexJones0 requested review from a team and cfrantz as code owners November 19, 2025 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant